package cn.iocoder.an.module.mold.dal.mysql.storage;

import java.util.*;

import cn.iocoder.an.framework.common.pojo.PageResult;
import cn.iocoder.an.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.an.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.an.module.mold.dal.dataobject.storage.StorageDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.an.module.mold.controller.admin.storage.vo.*;

/**
 * 模具储位 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface StorageMapper extends BaseMapperX<StorageDO> {

    default PageResult<StorageDO> selectPage(StoragePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StorageDO>()
                .eqIfPresent(StorageDO::getStatus, reqVO.getStatus())
                .eqIfPresent(StorageDO::getWarehouseId, reqVO.getWarehouseId())
                .likeIfPresent(StorageDO::getCode, reqVO.getCode())
                .likeIfPresent(StorageDO::getName, reqVO.getName())
                .eqIfPresent(StorageDO::getNumber, reqVO.getNumber())
                .betweenIfPresent(StorageDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StorageDO::getId));
    }

}